﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace JaxDug.Core.Generics
{

        public static class GenericTypeManager
        {
            /// <summary>
            /// Gets all the fields and properties for the specified type
            /// </summary>
            /// <param name="t">Type</param>
            /// <returns>Type</returns>
            public static IEnumerable<string> GetAllProperties(Type t)
            {
                if (t == null)
                    return Enumerable.Empty<string>();

                var flags = BindingFlags.Public
                          | BindingFlags.NonPublic
                          | BindingFlags.Static
                          | BindingFlags.Instance
                          | BindingFlags.DeclaredOnly;


                return t.GetProperties(flags).Select(x => x.Name);
            }
        }

}
